function getText(el) {
	var text = "";
	if (el != null) {
		if (el.childNodes) {
			for ( var i = 0; i < el.childNodes.length; i++) {
				var childNode = el.childNodes[i];
				if (childNode.nodeValue != null) {
					text = text + childNode.nodeValue;
				}
			}
		}
	}
	return text;
}

function replaceText(el, newNode) {
	if (el != null) {
		clearText(el);
		el.appendChild(newNode);
	}
}

function clearText(el) {
	if (el != null) {
		if (el.childNodes) {
			for ( var i = 0; i < el.childNodes.length; i++) {
				var childNode = el.childNodes[i];
				el.removeChild(childNode);
			}
		}
	}
}

function removeAllChild(el) {
	while (el.hasChildNodes()) {
		for ( var i = 0; i < el.childNodes.length; i++) {
			var childNode = el.childNodes[0];
			el.removeChild(childNode);
		}
	}
}

function removeElement(el) {
	if (el != null) {
		el.parentNode.removeChild(el);
	}
}

function countBrothers(object) {
	var parent = object.parentNode;
	var eldest = parent.firstChild.nextSibling;
	var cnt = 0;
	while (object != eldest) {
		object = object.previousSibling;
		cnt++;
	}
	return cnt;
}